package com.zy.producer.controller;

import com.zy.producer.domain.Stocks;
import com.zy.producer.service.StocksService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author 这是那头猪？
 * @version 1.0
 * @description:
 * @date 2023/10/13 10:06
 */
@Api(tags = "库存模块")
@RestController
public class IndexController {
    @Resource
    StocksService stocksService;

    @ApiOperation(value = "减少库存")
    @GetMapping("/setStock")
    public void setStock(){
        Stocks byId = stocksService.getById(1);
        byId.setQuantity(byId.getQuantity()-1);
        stocksService.updateById(byId);
    }
}